#ifndef _DEFS_H_
#define _DEFS_H_

#ifdef  __cplusplus
# define __HOLO_CLIENT_BEGIN_DECLS  extern "C" {
# define __HOLO_CLIENT_END_DECLS    }
#else
# define __HOLO_CLIENT_BEGIN_DECLS
# define __HOLO_CLIENT_END_DECLS
#endif

#define HOLO_MAX_LOG_LEN        1024

#define HOLO_CLIENT_MAX_THREAD_SIZE 64

#define HOLO_LOG_LEVEL_DEBUG    200
#define HOLO_LOG_LEVEL_INFO     300
#define HOLO_LOG_LEVEL_WARNING  400
#define HOLO_LOG_LEVEL_ERROR    500
#define HOLO_LOG_LEVEL_FATAL    600
#define HOLO_LOG_LEVEL_NONE     10000

/*
 * Oids of holo-client-c support types
 * copy from pg_type_d.h
 */
#define HOLO_TYPE_BOOL          16
#define HOLO_TYPE_INT2          21
#define HOLO_TYPE_INT4          23
#define HOLO_TYPE_INT8          20
#define HOLO_TYPE_FLOAT4        700
#define HOLO_TYPE_FLOAT8        701
#define HOLO_TYPE_NUMERIC       1700
#define HOLO_TYPE_BYTEA         17
#define HOLO_TYPE_CHAR          18
#define HOLO_TYPE_TEXT          25
#define HOLO_TYPE_VARCHAR       1043
#define HOLO_TYPE_DATE          1082
#define HOLO_TYPE_TIMESTAMP     1114
#define HOLO_TYPE_TIMESTAMPTZ   1184
#define HOLO_TYPE_JSON          114
#define HOLO_TYPE_JSONB         3802
#define HOLO_TYPE_BOOL_ARRAY    1000
#define HOLO_TYPE_INT2_ARRAY    1005
#define HOLO_TYPE_INT4_ARRAY    1007
#define HOLO_TYPE_INT8_ARRAY    1016
#define HOLO_TYPE_FLOAT4_ARRAY  1021
#define HOLO_TYPE_FLOAT8_ARRAY  1022
#define HOLO_TYPE_TEXT_ARRAY    1009
#define HOLO_TYPE_NUMERIC_ARRAY 1231
#define HOLO_TYPE_VARCHAR_ARRAY 1015
#define HOLO_TYPE_BYTEA_ARRAY   1001
#define HOLO_TYPE_CHAR_ARRAY    1002
#define HOLO_TYPE_JSON_ARRAY    199
#define HOLO_TYPE_JSONB_ARRAY   3807
#define HOLO_TYPE_DATE_ARRAY    1182
#define HOLO_TYPE_TIMESTAMP_ARRAY   1115
#define HOLO_TYPE_TIMESTAMPTZ_ARRAY 1185

/**
 * Errcode for holo-client-c
 */
#define HOLO_CLIENT_RET_OK                  0
#define HOLO_CLIENT_RET_FAIL                -1
#define HOLO_CLIENT_FLUSH_FAIL              -100

#define HOLO_CLIENT_INVALID_PARAM           -200
#define HOLO_CLIENT_INVALID_COL_IDX         -201
#define HOLO_CLIENT_INVALID_COL_NAME        -202
#define HOLO_CLIENT_TYPE_NOT_MATCH          -203
#define HOLO_CLIENT_COL_ALREADY_SET         -204
#define HOLO_CLIENT_NOT_NULL_BUT_SET_NULL   -205
#define HOLO_CLIENT_COL_NOT_PK              -206

#define HOLO_CLIENT_CHECK_CONSTRAINT_FAIL   -300
#define HOLO_CLIENT_PK_IS_NULL              -301
#define HOLO_CLIENT_PARTITION_IS_NULL       -302
#define HOLO_CLIENT_DELETE_NO_PK_TABLE      -303
#define HOLO_CLIENT_PARTITION_NOT_EXIST     -304
#define HOLO_CLIENT_PK_NOT_SET_IN_DELETE    -305
#define HOLO_CLIENT_NOT_NULL_BUT_NOT_SET    -306
#define HOLO_CLIENT_PARTITION_META_CHANGE   -307

#define HOLO_CLIENT_EXCEED_MAX_BYTE         -400
#define HOLO_CLIENT_EXCEED_MAX_NUM          -401
#define HOLO_CLIENT_EXCEED_MAX_INTERVAL     -402
#define HOLO_CLIENT_EXCEED_MAX_TOTAL_BYTE   -403

#endif